import axios from 'axios'
import { ADD_TODO_ITEM, CHANGE_INPUT_VALUE, INIT_DATA, GET_INIT_DATA } from './actionTypes'
export const getInputChangeAction = (value) => ({
  type: CHANGE_INPUT_VALUE,
  value: value
});
export const addTodoItemAction = (value) => ({
  type: ADD_TODO_ITEM,
  value: value
});
export const initDataAction = (data) => ({
  type: INIT_DATA,
  value: data
});
export const getInitList = () => ({
  type: GET_INIT_DATA,
});

export const getTodoList = () => {
  return (dispatch) => {
    axios.get('http://192.168.56.1:9999/abc.json').then(data => {
      const action = initDataAction(data.data);
      dispatch(action)
    })
  }
}